package lab02.test6;

/**
 * Created by dell on 2017/10/15.
 */
public class trianger {

        double side1;
        double side2;
        double side3;
        double area;
        double perimeter;

        public void setSide1(double side1) {this.side1 = side1;}
        public void setSide2(double side2) {this.side2 = side2;}
        public void setSide3(double side3) {this.side3 = side3;}
        public double getSide1() {return side1;}
        public double getSide2() {return side2;}
        public double getSide3() {return side3;}
        public double getArea() {
            double p = (side1 + side2 + side3) / 2;
            area = Math.sqrt(p * (p - side1) * (p - side2) * (p - side3));//海伦公式
            return area;
        }
        public double getPerimeter() {perimeter = side1 + side2 + side3;return perimeter;}
        public void changeSide(double side1, double side2, double side3) {
            this.side1 = side1;
            this.side2 = side2;
            this.side3= side3;
        }
        public void setNewSide1(double side1) {this.side1 = side1;}
        public void setNewSide2(double side2) {this.side2 = side2;}
        public void setNewSide3(double side3) {this.side3 = side3;}
        public double getNewSide1() {return side1;}
        public double getNewSide2() {return side2;}
        public double getNewSide3() {return  side3;}
        public boolean judgeSide() {
            if(side1 + side2 > side3 && side3 + side2 > side1 && side1 + side3 > side2 &side1 - side2 < side3 && side3 - side2 < side1 && side1 - side3 < side2) {
                return true;
            }
            else {
                return false;
            }
        }

}
